package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.AddressManagement;
import com.woniuxy.entity.dto.AddressManagementDTO;
import com.woniuxy.entity.dto.GoodsManagementDTO;
import com.woniuxy.mapper.AddressManagementMapper;
import com.woniuxy.service.AddressManagementService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
public class AddressManagementServiceImpl implements AddressManagementService {
    @Resource
    private AddressManagementMapper addressManagementMapper;
    @Override
    public ResponseData<?> queryCustomerAddress(PageData<AddressManagementDTO> pageData) {
        PageHelper.startPage(pageData.getPageNum(),pageData.getPageSize());
        List<AddressManagementDTO> addressManagementDTOS = addressManagementMapper.queryCustomerAddress(pageData.getParam());
        PageInfo pageInfo = new PageInfo(addressManagementDTOS);
        return new ResponseData<>().ok(pageInfo);
    }

    @Override
    public ResponseData<?> updateCustomerAddress(AddressManagementDTO addressManagementDTO) {
        addressManagementMapper.updateCustomerAddress(addressManagementDTO);
        return new ResponseData<>().ok();
    }
}
